<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page contentType="text/html;charset=utf-8" pageEncoding="utf-8"
	language="java"%>
<%@ include file="/jsp/platform/include/include.jsp"%>
<script src="<%=request.getContextPath()%>/script/jquery-1.4.2.js"
	type="text/javascript"></script>
<LINK href="<%=request.getContextPath()%>/style/easyui.css" rel="stylesheet" type="text/css">
<SCRIPT src="<%=request.getContextPath()%>/script/jquery.easyui.min.js" type="text/javascript"></SCRIPT>	
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
* {
	padding: 0;
	margin: 0;
}

body {
	color: #4e4e4e;
}

li {
	list-style: none;
}

a {
	text-decoration: none;
}

input,img,select {
	vertical-align: middle;
}

.modalWindowWrapper {
	padding: 20px;
}

.listWrapper {
	width: 350px;
	margin: 0 auto;
	overflow: hidden;
	padding: 0 0 10px;
}

.listLeft,.listRight {
	display: block;
	height: 40px;
	line-height: 40px;
	font-family: microsoft yahei;
	font-size: 16px;
}

.listLeft {
	width: 120px;
	text-align: right;
	float: left;
}

.listRight {
	width: 220px;
	padding-left: 10px;
	float: right;
}

.btnConfirm,.btnCancel {
	display: block;
	width: 80px;
	height: 40px;
	line-height: 40px;
	text-align: center;
	font-family: microsoft yahei;
	font-size: 16px;
	float: left;
	border: none;
	cursor: pointer;
}

.btnConfirm {
	background: #c2352a;
	color: #fff;
}

.btnCancel {
	background: #d7d7d7;
	color: #4e4e4e;
	margin-left: 40px;
}
</style>
<script type="text/javascript">
        $(document).ready(function() {
           //菜单分组
           <common:getDicListByKey key="1121" var="menuTypeList"/>
           //子菜单分组
           <common:getDicListByKey key="1131" var="subMenuTypeList"/>
           //菜单分组
           $("#menuType").val(<c:out value='${model.menuType}'/>);
           //子菜单分组
           $("#subMenuType").val(<c:out value='${model.subMenuType}'/>);
        })
        /**
         　　               修改
         */
        function modifySubmit() {
            var _msg = "";
            if (isBlank($("#menuName").val())) {
                _msg = "菜单名称不能为空\n";
            }
            if (isBlank($("#url").val())) {
                _msg = "菜单地址不能为空\n";
            }
            if (_msg != "") {
                $.messager.alert("提示信息", _msg);
            } else {
                var menuId = $("#menuId").val();
                var url = '<%=request.getContextPath()%>/manage/menus/update';
                if (menuId == '-1'||menuId == null ||menuId == "") {
                    url = '<%=request.getContextPath()%>/manage/menus/add';
                    menuId = "";
                }
                $.post(
                        url,
                        {
                            'menuId' : menuId,
                            'menuName' : $("#menuName").val(),
                            'parentId' : $("#parentId").val(),
                            'url' : $("#url").val(),
                            'dept' : $("#dept").val(),
                            'createDate' : $("#createDate").val(),
                            'menuType' : $("#menuType").val(),
                            'orders' : $("#orders").val(),
                            'subMenuType' : $("#subMenuType").val()
                        },
                        function(data) {
                            if (data.success) {
                                $.messager.alert("提示信息", data.msg);
                                window.parent.document.location = window.parent.document.location;
                                parentDialog.close();
                            } else {
                                $.messager.alert("提示信息", data.msg);
                            }
                        });
            }
        }
        function Btnclose() {
            parentDialog.close();
        }
        function isBlank(obj) {
		    if ("" == obj || undefined == obj) {
		        return true;
		    }
		    return false;
		}
    </script>
</head>

<body>
	<div class="modalWindowWrapper">
		<input type="hidden" id="menuId" name="menuId"
			value="<c:out value='${model.menuId}'/>" /> <input type="hidden"
			id="dept" name="dept" value="<c:out value='${model.dept}'/>" /> <input
			type="hidden" id="createDate" name="createDate"
			value="<fmt:formatDate value='${model.createDate}' type='both'/>" />
		<ul class="listWrapper">
			<li class="listLeft">菜单名称：</li>
			<li class="listRight"><input type="text"
				style="width:210px;height:34px;line-height:34px;float:left;"
				name="menuName" id="menuName"
				value="<c:out value='${model.menuName}'/>" />
			</li>
		</ul>
		<ul class="listWrapper">
			<li class="listLeft">菜单地址：</li>
			<li class="listRight"><input type="text"
				style="width:210px;height:34px;line-height:34px;float:left;"
				name="url" id="url" value="<c:out value='${model.url}'/>" />
			</li>
		</ul>
		<ul class="listWrapper">
			<li class="listLeft">排序：</li>
			<li class="listRight"><input type="text"
				style="width:210px;height:34px;line-height:34px;float:left;"
				name="orders" id="orders" value="<c:out value='${model.orders}'/>" />
			</li>
		</ul>
		<ul class="listWrapper">
			<li class="listLeft">父ID：</li>
			<li class="listRight"><input type="text"
				style="width:210px;height:34px;line-height:34px;float:left;"
				name="parentId" id="parentId"
				value="<c:out value='${model.parentId}'/>" />
			</li>
		</ul>
		<ul class="listWrapper">
			<li class="listLeft">菜单分组：</li>
			<li class="listRight"><select
				style="display:block;border:none;width:120px;height:30px;line-height:30px;float:left;font-size:14px;"
				id="menuType" value="<c:out value='${model.menuType}'/>"><c:forEach
						var="list" items="${menuTypeList}">
						<option value="${list.dirValue}">
							<c:out value='${list.dirCaption}' />
						</option>
					</c:forEach>
			</select>
			</li>
		</ul>
		<ul class="listWrapper">
			<li class="listLeft">二级菜单分组：</li>
			<li class="listRight"><select
				style="display:block;border:none;width:120px;height:30px;line-height:30px;float:left;font-size:14px;"
				id="subMenuType" value="<c:out value='${model.subMenuType}'/>"><c:forEach
						var="list" items="${subMenuTypeList}">
						<option value="${list.dirValue}">
							<c:out value='${list.dirCaption}' />
						</option>
					</c:forEach>
				</select>	
			</li>
		</ul>
		<div
			style="width:200px;margin:0 auto;overflow:hidden;padding-top:10px;">
			<input class="btnConfirm" type="button" onclick="modifySubmit()"
				value="确定" /> <input class="btnCancel" type="button"
				onclick="Btnclose()" value="取消" />
		</div>
	</div>
</body>
</html>
